#include <stdio.h>
#include <string.h>
#include <unistd.h>

// 进度条

int main()
{
#define NUM 100

    char arr[NUM + 1];

    memset(arr, '\0', sizeof(arr));

    const char* str = "|/-\\";

    int i = 0;
    while (i <= 100)
    {
        printf("[%-100s][%3d%%]%c\r", arr, i, str[i % 4]);
        fflush(stdout);
        arr[i] = '#';
        i ++ ;

        usleep(50000);
    }
    printf("\n");

    return 0;
}
